<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>

<!DOCTYPE html>
<html>
  <head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>Tplay后台登录</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link id="layuicss-layer" rel="stylesheet" href="${webPath }/lib/layuicms/layui/css/layui.css" media="all">
  <link href="${webPath }/lib/css/login.css" rel="stylesheet" />
  <%@include file="/WEB-INF/common/script.jsp"%><!--静态包含-->
  </head>
<body class="layui-layout-body">
  <div id="LAY_app">
  <div class="layadmin-user-login" id="LAY-user-login" style="display: none;">

  <div class="layadmin-user-login-main">
    <div class="layadmin-user-login-box layadmin-user-login-header">
      <h2>Topic在线答题</h2>
      <p>体验springboot+Layui2的极速双飞快感</p>
    </div>
    <div class="layadmin-user-login-box layadmin-user-login-body layui-form">
      <form class="layui-form" id="login">
        <div class="layui-form-item">
          <label class="layadmin-user-login-icon layui-icon layui-icon-username" for="LAY-user-login-username"><i class="fa fa-user"></i></label>
          <input type="text" name="nikeName" lay-verify="required" autocomplete="off" placeholder="用户名:demo" class="layui-input" >
        </div>
        <div class="layui-form-item">
          <label class="layadmin-user-login-icon layui-icon layui-icon-password" for="LAY-user-login-password"><i class="fa fa-unlock-alt"></i></label>
          <input type="password" name="password" lay-verify="required" autocomplete="off" placeholder="密码:tplay" class="layui-input">
        </div>
        <div class="layui-form-item">
          <label class="layadmin-user-login-icon layui-icon layui-icon-password" for="LAY-user-login-password"><i class="fa fa-code"></i></label>
          <!-- <input type="text"  autocomplete="off" placeholder="验证码" class="layui-input" style="width:62%;float: left;margin-right:11px;"><img src="/tplay/public/captcha.shtml" alt="captcha" onclick="this.src='/tplay/public/captcha.shtml?seed='+Math.random()" height="36" id="captcha" style="margin-top: 1px" /> -->
        </div>
        <div class="layui-form-item">
          <input type="checkbox" lay-skin="primary" title="记住账号" name="remember" value="1" ><div class="layui-unselect layui-form-checkbox" lay-skin="primary"><span>记住账号?</span><i class="layui-icon"></i></div>
        </div>
        <div class="layui-form-item">
          <button id="loginBtn" class="layui-btn layui-btn-fluid" lay-submit lay-filter="login">登 入</button>
        </div>
        <input type="hidden" value="37e43fba878e028e9823140aaf58f1cd93a84673" />     
         </form>
    </div>
  </div>
  
</div>

</div>
<script src="${webPath }/lib/layuicms/layui/layui.js"></script>
    <script>
        layui.use(['layer', 'form','jquery'], function() {
            var layer = layui.layer,
                $ = layui.jquery,
                form = layui.form;
            $('#loginBtn').click(function(){
            	var data = {};
            	data['nikeName'] = $('input[name="nikeName"]').val(),data['password'] = $('input[name="password"]').val();
            	console.log(data)
            	 $.ajax({
                        url:webPath+"loginController/loginCheck",
                        data:data,
                        type:'post',
                        async: false,
                        success:function(res) {
                        	var res = JSON.parse(res); 
                            layer.msg(res.msg,{offset: '50px',anim: 1});
                            if(res.code == 200) {
                                    location.href = webPath+'loginController/main';
                            } else {
                                $('#captcha').click();
                            }
                        },
                        error:function(e){
                        	alert(e)
                        }
                    })
            	return false;
            });
        });
    </script>
</body>
</html>